/**
 * ztree
 */
var setting = {
    check: {
        enable: true
    },
    view: {
        dblClickExpand: false,
        showLine: true,
        selectedMulti: false
    },
    data: {
        key: {
            name: "text",
        },
        simpleData: {
            enable: true,
            idKey: "id",
            pIdKey: "pId",
            rootPId: "0"
        }
    },
    callback: {
        beforeClick: function (treeId, treeNode) {
            clickTree(treeNode)
        }
    }
};
function clickTree(node) {

}

function loadSuccess(node) {
}

var ztree = {
    load: function (url, treeid) {
        $.ajax({
            url: url,
            type: 'post',
            async: false,
            success: function (data) {
                var t = $("#" + treeid);
                t = $.fn.zTree.init(t, setting, data.result);
                var zTree = $.fn.zTree.getZTreeObj(treeid);
                var nodes = zTree.getNodes();
                if (nodes[0] == undefined) {
                    return;
                }
                loadSuccess(nodes[0]);
            }
        });
    }
};